[#escape x as x?html]
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户驾驶员编辑</title>
[#include "/include/jsvalidation.ftl"]
[#include "/include/main.ftl"]
 [#include "/include/popdialog.ftl"]
<script>
            function sfzhm_change()
            {
                var val = $('#cardNo').val();
                var birthdayValue,sexValue;    
                if(15==val.length || 18==val.length)
                {
                                   
                    if(15==val.length)
                    {
                        //15位身份证号码
                        birthdayValue = val.charAt(6)+val.charAt(7);
                       
                        if(parseInt(birthdayValue) < 10)
                        {
                            birthdayValue = '20'+birthdayValue;
                        }
                        else
                        {
                            birthdayValue = '19'+birthdayValue;
                        }                       
                        birthdayValue=birthdayValue+'-'+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11);
                        $('#birthDay').val(birthdayValue);
                        if(parseInt(val.charAt(14)/2)*2!=val.charAt(14))
                        {
                            $('#sex').val('男');                                   
                        }
                        else
                        {
                            $('#sex').val('女');
                        }               
                    }
                    if(18==val.length)
                    {
                        //18位身份证号码
                        birthdayValue=val.charAt(6)+val.charAt(7)+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11)+'-'+val.charAt(12)+val.charAt(13);
                        $('#birthDay').val(birthdayValue);
                        if(parseInt(val.charAt(16)/2)*2!=val.charAt(16))
                            $('#sex').val('男');      
                        else
                            $('#sex').val('女');                                                                           
                    }                            
                }
                else
                {   
                    alert('必须输入15位或18位身份证号码！');
                }
            }
        </script>
</head>
<body>
[#if (obj.op!'')='close']
<script>closeDialog();</script>
[/#if]
                <form name="mainForm" id="mainForm" method="post" action="/Ins/customer/driver/save"  onsubmit="if (va.validate()) formSubmit(this);else return false;">
<INPUT TYPE="hidden" NAME="sn" VALUE="${obj.CustomerDriverObj.sn?default('')}">
<INPUT TYPE="hidden" NAME="mainSn" VALUE="${obj.CustomerDriverObj.mainSn?default('')}">
                        <div id="CustomerDriver_base">
<p>
姓名  <input type="text"  size="20" id="name" name="name" class="max-length-40 ">

<script>$("#name").val("${(obj.CustomerDriverObj.name)?default('')}");</script>
 </p>
<p>
证号
  <input type="text"  size="20" id="cardNo" name="cardNo" class="max-length-40 " onChange="sfzhm_change()">
  </p>
<p>性别


  <select name="sex" id="sex">
    <option value="" selected></option>
    <option value="男">男</option>
    <option value="女">女</option>
  </select>

  <script>$("#sex").val("${(obj.CustomerDriverObj.sex)?default('')}");</script>
  </p>
<p>
出生日期  
  <input type="text"  size="20" id="birthDay" name="birthDay" class="validate-date-yyyy-MM-dd" onClick="popCalendar(this)" >
  <script>$("#birthDay").val("${(obj.CustomerDriverObj.birthDay?string('yyyy-MM-dd'))?default('')}");</script>
</p>
<p>国籍
  <input name="country" type="text" class="max-length-40 " id="country" value="中国"  size="20">
  
  <script>$("#country").val("${(obj.CustomerDriverObj.country)?default('中国')}");</script>
</p>
<p>
住址  <input type="text"  size="20" id="address" name="address" class="max-length-200 ">

<script>$("#address").val("${(obj.CustomerDriverObj.address)?default('')}");</script>
 </p>
<p>
  <script>$("#cardNo").val("${(obj.CustomerDriverObj.cardNo)?default('')}");</script>初次领证时间  <input type="text"  size="20" id="firstCardDate" name="firstCardDate" class="validate-date-yyyy-MM-dd" onClick="popCalendar(this)" >

<script>$("#firstCardDate").val("${(obj.CustomerDriverObj.firstCardDate?string('yyyy-MM-dd'))?default('')}");</script>
 </p>
<p>
准驾车型  <input type="text"  size="20" id="quasiDriving" name="quasiDriving" class="max-length-10 ">

<script>$("#quasiDriving").val("${(obj.CustomerDriverObj.quasiDriving)?default('')}");</script>
 </p>
<p>
有效起始日期  <input type="text"  size="20" id="validBeginDate" name="validBeginDate" class="validate-date-yyyy-MM-dd" onClick="popCalendar(this)" >

<script>$("#validBeginDate").val("${(obj.CustomerDriverObj.validBeginDate?string('yyyy-MM-dd'))?default('')}");</script>
 </p>
<p>
有效期限  <input type="text"  size="20" id="validDate" name="validDate" class="validate-date-yyyy-MM-dd" onClick="popCalendar(this)" >

<script>$("#validDate").val("${(obj.CustomerDriverObj.validDate?string('yyyy-MM-dd'))?default('')}");</script>
 </p>
 <input type="submit" name="button" id="button" value="提交">

                        </div>

                </form>
                <script>
                  va = new Validation('mainForm');
                </script>

</div>
</body>
</html>
[/#escape]
